home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-coverdisks-
/
126a
/
football
/
user
/
combination.rexx
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
40KB
|
1,303 lines
/* ***********************************************************************
COMBINATION PROGRAM FOR FOOTBALL REXX SUITE
---------------------------------------------
Copyright Mark Naughton 1999
From an idea by Kevin Lambert
Version Date History
--------------------------------------------------------------------------
1.0 200499 After lifting code from other programs and tailoring
it for this, this is now ready for testing.
All working ok.
240499 Added league information from LStats.rexx.
250499 Fixed bug where percentages couldn't be calculated if
the results/matches were zero - from LStats.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Check options.
3. Read league name from 'df' file.
4. Depending on options selected, run the appropriate routine. These have
not been documented as they are covered in other files.
5. Display information.
6. IF option to write the files to a directory has not been chosen,
display data.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
league_file = "Data/" || league_stuff
league_title = '*LEAGUE_NAME='
separator = '*'
/*******************************************************************/
/* ** THESE PARAMETERS CAN BE CHANGED TO SUIT YOUR REQUIREMENTS ** */
/*******************************************************************/
select_fixtures = "YES" /* or "NO" */
select_statistics = "NO"
select_table = "NO"
select_leaginfo = "YES"
output_dir = "NONE" /* NONE redirects output to the */
/* console or enter complete path */
/* for files to be written */
/*******************************************************************/
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
select_fixtures = upper(select_fixtures)
select_statistics = upper(select_statistics)
select_table = upper(select_table)
select_leaginfo = upper(select_leaginfo)
if select_fixtures ~= "YES" & select_statistics ~= "YES" & select_table ~= "YES" & select_leaginfo ~= "YES" then do
say
say "ERROR : (Combination)"
say
say "No options were selected."
exit
end
if open(datafile,league_file||input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(league_title,line) > 0 then
title = delstr(line,1,13)
end
close(datafile)
end
else do
say
say "ERROR : (Combination)"
say
say "Cannot open '"league_file||input_file"' for reading."
exit
end
if select_fixtures = "YES" then
call create_fixs(league_stuff,output_dir)
if select_statistics = "YES" then
tcount = create_statistics(league_stuff,output_dir)
if select_table = "YES" then
call create_table(league_stuff,output_dir)
if select_leaginfo = "YES" then
call create_linfo(league_stuff,output_dir)
osl = 1
say
say center("Combination",78)
say "-----------------------------------------------------------------------------------------"
say
say
say center("League: "title,78)
say
say
say
if select_leaginfo = "YES" then do
if osl=1 then say "Options Selected: League Information"
osl = 0
end
if select_statistics = "YES" then do
if osl=1 then say "Options Selected: Team Statistics"
else say " Team Statistics"
osl = 0
end
if select_fixtures = "YES" then do
if osl=1 then say "Options Selected: League Fixtures"
else say " League Fixtures"
osl = 0
end
if select_table = "YES" then do
if osl=1 then say "Options Selected: League Table"
else say " League Table"
end
say
if output_dir ~= "NONE" then do
say "The following files have been written to '"output_dir"' :"
say
if select_fixtures = "YES" then say " "league_stuff".fix"
if select_statistics = "YES" then say " "league_stuff".Team<number 1-"tcount">.stat"
if select_table = "YES" then say " "league_stuff".tab"
if select_leaginfo = "YES" then say " "league_stuff".linf"
end
else do
say
say
say
if select_leaginfo = "YES" then do
say
say center("League Information",78)
say "-----------------------------------------------------------------------------------------"
say
say
if open(datafile,"RAM:"league_stuff".linf",'r') then do
do while ~eof(datafile)
line = readln(datafile)
say line
end
close(datafile)
say
say
end
else do
say
say "ERROR : (Combination)"
say
say "Unable to open 'RAM:"league_stuff".linf' file."
end
say
filen = "RAM:"league_stuff".linf"
address command 'delete >NIL: 'filen
end
if select_statistics = "YES" then do
say
say
say center("Team Statistics",78)
say "-------------------------------------------------------------------------------"
say
say
do kk=1 to tcount
if open(datafile,"RAM:"league_stuff"_Team"kk".stat",'r') then do
do while ~eof(datafile)
line = readln(datafile)
say line
end
close(datafile)
end
else do
say
say "ERROR : (Combination)"
say
say "Unable to open 'RAM:"league_stuff"_Team"kk".stat' file."
end
say
filen = "RAM:"league_stuff"_Team"kk".stat"
address command 'delete >NIL: 'filen
end
end
if select_fixtures = "YES" then do
say
say
say center("League Fixtures",78)
say "-----------------------------------------------------------------------------------------"
say
say
if open(datafile,"RAM:"league_stuff".fix",'r') then do
do while ~eof(datafile)
line = readln(datafile)
say line
end
close(datafile)
end
else do
say
say "ERROR : (Combination)"
say
say "Unable to open 'RAM:"league_stuff".fix' file."
end
say
filen = "RAM:"league_stuff".fix"
address command 'delete >NIL: 'filen
end
if select_table = "YES" then do
say
say
say
say center("League Table",78)
say "-----------------------------------------------------------------------------------------"
say
say
say
say " Team Pl Won Drw Lst GoalsF GoalsA Pts GoalDiff"
say "-----------------------------------------------------------------------------------------"
a = 1
if open(datafile,"RAM:"league_stuff".tab",'r') then do
do while ~eof(datafile)
line = readln(datafile)
if line ~= '' then do
if strip(substr(line,76,5)) = 0 then line=overlay("",line,76,5," ")
if a<10 then do
if a = 1 then line = upper(line)
say " "a") "line
end
else
say a") "line
a = a + 1
end
end
close(datafile)
end
else do
say
say "ERROR : (Combination)"
say
say "Unable to open 'RAM:"league_stuff".tab' file."
end
say
filen = "RAM:"league_stuff".tab"
address command 'delete >NIL: 'filen
end
end
exit
/* Procedure --------------------------------------------------------- */
create_fixs : procedure
parse arg league_table,output_dr
league_file = "Data/"league_table
input_file = '.df'
input2_file = '.sf'
autosched = '*AUTOSCHD='
separator = '*'
autos = 0
if open(datafile,league_file||input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(autosched,line